
<template>
    <el-header>
        <div class="l-content">
            <!-- 图标 -->
            <el-button @click="handelCollapse()" size="small">
                <el-icon>
                    <Menu />
                </el-icon>
            </el-button>
            <el-breadcrumb separator="/" >
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item :to="current.path" v-if="current">{{ current.label }}</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="r-content">
            <!-- 下拉框 -->
            <el-dropdown>
                <img class="user" :src="getImgSrc('user')" alt="">
                <template #dropdown>
                    <el-dropdown-menu>
                        <el-dropdown-item>Action 1</el-dropdown-item>
                        <el-dropdown-item>Action 2</el-dropdown-item>
                    </el-dropdown-menu>
                </template>
            </el-dropdown>
        </div>
    </el-header>
</template>

<script setup>
import { computed } from "vue";
// 引入仓库
import { useAside } from '@/store/index.js';
const main=useAside()

// 动态引入
const getImgSrc = (val)=>{
    return new URL(`../assets/${val}.jpg`, import.meta.url).href
}

// 更改仓库的值
const handelCollapse = ()=>{
    main.updateIsCollapse()
}

const current =computed(()=>{
    return main.currentMenu
})

</script>


<style lang="less">
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background-color: #333;
}

.r-content {
    .user {
        width: 30px;
        height: 30px;
        border-radius: 50%;
    }
}

.l-content {
    display: flex;
    justify-content: center;
    align-items: center;

    .el-button {
        margin-right: 20px;
    }

    p {
        color: #ffff;
    }
}

.el-breadcrumb__inner{
    color: #ffff !important;
    cursor: pointer !important;
}

</style>